package com.stlm2.dems.dao.impl;

import org.springframework.stereotype.Repository;

import com.stlm2.dems.entity.Collections;
import com.stlm2.dems.dao.CollectionsDao;
import com.stlm2.core.base.impl.BaseDaoImpl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository("collectionsDao")
public class CollectionsDaoImpl extends BaseDaoImpl<Collections> implements CollectionsDao {

    @Override
    public List<Collections> getByGoodsId(Integer userId, Integer goodsId) {
        Map<String,Object> map=new HashMap<String, Object>();
        map.put("goodsId",goodsId);
        map.put("userId",userId);
        return selectList("getByGoodsId",map);
    }

    @Override
    public void cleanMyCollections(Integer userId) {
        delete("deleteByUserId",userId);
    }


    @Override
    public Integer getCount(Integer userId) {
        return (Integer) _selectOne("getCount",userId);
    }
}